<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
session_start();

include_once( 'config.php' );
include_once( 'saetv2.ex.class.php' );

$c = new SaeTClientV2( WB_AKEY , WB_SKEY , "2.00snOcyBnb6TFCe9c1fa22c8m_2UuD");
$ms  = $c->home_timeline(); // done

//$ms  = $c->bilateral_timeline();
$uid_get = $c->get_uid();
$uid = $uid_get['uid'];
$user_message = $c->show_user_by_id( $uid);//根据ID获取用户等基本信息

?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>微博报-我的头条</title>
<link href="index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    //each遍历文本框
    $(":text").each(function() {
        //保存当前文本框的值
		$(this).css({"font-family":"Arial","font-size":"15px"})
        var vdefault = this.value;
        $(this).focus(function() {
            //获得焦点时，如果值为默认值，则设置为空
            if (this.value == vdefault) {
                this.value = "";
            }
        });
        $(this).blur(function() {
            //失去焦点时，如果值为空，则设置为默认值
            if (this.value == "") {
                this.value = vdefault;
            }
        });
    });
});
</script>
</head>

<body>
<div id="container"><!--页面层容器-->
    <div id="header"><!--页面头部-->
        <div id="log1"><img src="images/我的头条_不带图_窄_03.gif" /></div>
        <div id="userhead"><!--头像-->
        <a href="<?= 'http://weibo.com/u/'.(string)$uid ?>"><img src="<?=$user_message['profile_image_url']?> height="30" width="30""/></a>
        </div>	
        <div id="log2"><img src="images/我的头条_不带图_窄_05.gif" /></div>
    </div>
    <div id="pagebody"><!--页面主题-->
        <div id="topbar"><!--上边栏-->
       
        <form id="headform" name="myheader" method="post" action="">
        <input id="textfield" type="text"  name="text" value= '俗话说："独乐乐不如众乐乐"分享你的头条让大家都乐乐吧' />
        <input id="headbutton" type="submit"  name="headbutton" value="" />
        </form>
        <?php
        if( isset($_REQUEST['text']) ) 
        {
            $ret = $c->update( $_REQUEST['text'] );	//发送微博
            if ( isset($ret['error_code']) && $ret['error_code'] > 0 )
            {
                echo "<p>发送失败，错误：{$ret['error_code']}:{$ret['error']}</p>";
            }
            else 
                echo "<p>发送成功</p>";
        }
        ?>
        </div>
        <div id="mainbody"><!--主题内容-->
        <?php if( is_array( $ms['statuses'] ) ): ?>
        <?php foreach( $ms['statuses'] as $item ): ?>
            <div style="padding:10px;margin:10px 10px 0px 10px;border:none solid #ccc">
                <div style="wideth:50px;float:left; vertical-align:top" ><!--头像-->
                    <a href="<?='http://weibo.com/u/'.(string)$item['user']['id']?>">
                        <img  src="<?=$item['user']['profile_image_url']?>" style=" height="30" width="30"" padding=1px border-style="double"/></a>
                </div>
                <div class="pageinformation"><!--页面信息--><a style="color:#2D96BE ;text-decoration:none "  href="<?='http://weibo.com/u/'.(string)$item['user']['id']?>">
                        <span><?=$item['user'][	'screen_name']?></span></a>:<?=$item['text'];?></div>
            </div>
            <div class="datastyle"><!--时间--></div>
        <?php endforeach; ?>
        <?php endif; ?>
        </div>
    </div>
    <div id="footer"><!--页面底部-->
        <div class=copyright><!--底部版权-->
            <p>Copyright@2012智梦创科科技有限公司<br/>京网文[2011]0398-130号&nbsp;京ICP证100780号</p>
        </div>
        <div><!--底部图片--><img src="images/我的头条_不带图_窄_03.gif" /></div>
    </div>
</div>
</body>
</html>
